< previous page page_365 next page >

Page 365
e10a6a0a59f035e870d90cca05b85fce.gif
Option Explicit
' Two-dimensional object parent class.


' The object's textual serialization.
Public Serialization As String

' Draw the object on the canvas.
Public Sub Draw(ByVal canvas As Object)

End Sub

' Return this object's bounds.
Public Sub Bound( _
    ByRef xmin As Single, ByRef xmax As Single, _
    ByRef ymin As Single, ByRef ymax As Single)

End Sub
The following code shows a more complete implementation of the TwoDLine class. The Serialization property defined by the TwoDObject class is implemented with property procedures. Notice the strange syntax for declaring the methods defined by the TwoDObject class.
e10a6a0a59f035e870d90cca05b85fce.gif
Option Explicit
' Two-dimensional line object.

Implements TwoDObject

Public X1 As Single
Public Y1 As Single
Public X2 As Single
Public Y2 As Single

' Return this object's bounds.
Public Sub TwoDObject_Bound( _
    ByRef xmin As Single, ByRef xmax As Single, _
    ByRef ymin As Single, ByRef ymax As Single)

    If X1 < X2 Then
        xmin = X1
        xmax = X2
    Else
        xmin = X2
        xmax = X1
    End If
    If Y1 < Y2 Then
        ymin = Y1
        ymax = Y2

 
< previous page page_365 next page >